using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class CUSTINFOInfo
    {
		#region Local Variable
		public enum Field
		{
			CUSTID,
			TENGD,
			DAIDIEN,
			DIACHI,
			DIENTHOAI,
			FAX,
			MSTHUE,
			NHACUNGCAP,
			TAIKHOAN,
			NGANHANG,
			TINH_TP,
			HMDUNO,
			TRANSLOCK
		}
		private String _CUSTID;
		private String _TENGD;
		private String _DAIDIEN;
		private String _DIACHI;
		private String _DIENTHOAI;
		private String _FAX;
		private String _MSTHUE;
		private Boolean _NHACUNGCAP;
		private String _TAIKHOAN;
		private String _NGANHANG;
		private String _TINH_TP;
		private Double _HMDUNO;
		private Boolean _TRANSLOCK;
		
		public String CUSTID{	get{ return _CUSTID;} set{_CUSTID = value;} }
		public String TENGD{	get{ return _TENGD;} set{_TENGD = value;} }
		public String DAIDIEN{	get{ return _DAIDIEN;} set{_DAIDIEN = value;} }
		public String DIACHI{	get{ return _DIACHI;} set{_DIACHI = value;} }
		public String DIENTHOAI{	get{ return _DIENTHOAI;} set{_DIENTHOAI = value;} }
		public String FAX{	get{ return _FAX;} set{_FAX = value;} }
		public String MSTHUE{	get{ return _MSTHUE;} set{_MSTHUE = value;} }
		public Boolean NHACUNGCAP{	get{ return _NHACUNGCAP;} set{_NHACUNGCAP = value;} }
		public String TAIKHOAN{	get{ return _TAIKHOAN;} set{_TAIKHOAN = value;} }
		public String NGANHANG{	get{ return _NGANHANG;} set{_NGANHANG = value;} }
		public String TINH_TP{	get{ return _TINH_TP;} set{_TINH_TP = value;} }
		public Double HMDUNO{	get{ return _HMDUNO;} set{_HMDUNO = value;} }
		public Boolean TRANSLOCK{	get{ return _TRANSLOCK;} set{_TRANSLOCK = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public CUSTINFOInfo()
		{
			_CUSTID = "";
			_TENGD = "";
			_DAIDIEN = "";
			_DIACHI = "";
			_DIENTHOAI = "";
			_FAX = "";
			_MSTHUE = "";
			_NHACUNGCAP = true;
			_TAIKHOAN = "";
			_NGANHANG = "";
			_TINH_TP = "";
			_HMDUNO = 0;
			_TRANSLOCK = true;
		}
		public CUSTINFOInfo(
		String CUSTID,
		String TENGD,
		String DAIDIEN,
		String DIACHI,
		String DIENTHOAI,
		String FAX,
		String MSTHUE,
		Boolean NHACUNGCAP,
		String TAIKHOAN,
		String NGANHANG,
		String TINH_TP,
		Double HMDUNO,
		Boolean TRANSLOCK
		)
		{
			_CUSTID = CUSTID;
			_TENGD = TENGD;
			_DAIDIEN = DAIDIEN;
			_DIACHI = DIACHI;
			_DIENTHOAI = DIENTHOAI;
			_FAX = FAX;
			_MSTHUE = MSTHUE;
			_NHACUNGCAP = NHACUNGCAP;
			_TAIKHOAN = TAIKHOAN;
			_NGANHANG = NGANHANG;
			_TINH_TP = TINH_TP;
			_HMDUNO = HMDUNO;
			_TRANSLOCK = TRANSLOCK;
		}
		public CUSTINFOInfo(DataRow dr)
		{
			if (dr != null)
			{
				_CUSTID = dr[Field.CUSTID.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CUSTID.ToString()]);
				_TENGD = dr[Field.TENGD.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENGD.ToString()]);
				_DAIDIEN = dr[Field.DAIDIEN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DAIDIEN.ToString()]);
				_DIACHI = dr[Field.DIACHI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIACHI.ToString()]);
				_DIENTHOAI = dr[Field.DIENTHOAI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIENTHOAI.ToString()]);
				_FAX = dr[Field.FAX.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.FAX.ToString()]);
				_MSTHUE = dr[Field.MSTHUE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MSTHUE.ToString()]);
				_NHACUNGCAP = dr[Field.NHACUNGCAP.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.NHACUNGCAP.ToString()]);
				_TAIKHOAN = dr[Field.TAIKHOAN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TAIKHOAN.ToString()]);
				_NGANHANG = dr[Field.NGANHANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NGANHANG.ToString()]);
				_TINH_TP = dr[Field.TINH_TP.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TINH_TP.ToString()]);
				_HMDUNO = dr[Field.HMDUNO.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.HMDUNO.ToString()]);
				_TRANSLOCK = dr[Field.TRANSLOCK.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.TRANSLOCK.ToString()]);
			}
		}
		public CUSTINFOInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_CUSTID = dr[Field.CUSTID.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CUSTID.ToString()]);
				_TENGD = dr[Field.TENGD.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENGD.ToString()]);
				_DAIDIEN = dr[Field.DAIDIEN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DAIDIEN.ToString()]);
				_DIACHI = dr[Field.DIACHI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIACHI.ToString()]);
				_DIENTHOAI = dr[Field.DIENTHOAI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIENTHOAI.ToString()]);
				_FAX = dr[Field.FAX.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.FAX.ToString()]);
				_MSTHUE = dr[Field.MSTHUE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MSTHUE.ToString()]);
				_NHACUNGCAP = dr[Field.NHACUNGCAP.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.NHACUNGCAP.ToString()]);
				_TAIKHOAN = dr[Field.TAIKHOAN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TAIKHOAN.ToString()]);
				_NGANHANG = dr[Field.NGANHANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NGANHANG.ToString()]);
				_TINH_TP = dr[Field.TINH_TP.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TINH_TP.ToString()]);
				_HMDUNO = dr[Field.HMDUNO.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.HMDUNO.ToString()]);
				_TRANSLOCK = dr[Field.TRANSLOCK.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.TRANSLOCK.ToString()]);
			}
		}
		public CUSTINFOInfo(CUSTINFOInfo objEntr)
		{			
			_CUSTID = objEntr.CUSTID;			
			_TENGD = objEntr.TENGD;			
			_DAIDIEN = objEntr.DAIDIEN;			
			_DIACHI = objEntr.DIACHI;			
			_DIENTHOAI = objEntr.DIENTHOAI;			
			_FAX = objEntr.FAX;			
			_MSTHUE = objEntr.MSTHUE;			
			_NHACUNGCAP = objEntr.NHACUNGCAP;			
			_TAIKHOAN = objEntr.TAIKHOAN;			
			_NGANHANG = objEntr.NGANHANG;			
			_TINH_TP = objEntr.TINH_TP;			
			_HMDUNO = objEntr.HMDUNO;			
			_TRANSLOCK = objEntr.TRANSLOCK;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("CUSTINFO");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.CUSTID.ToString(), typeof(String)),
				new DataColumn(Field.TENGD.ToString(), typeof(String)),
				new DataColumn(Field.DAIDIEN.ToString(), typeof(String)),
				new DataColumn(Field.DIACHI.ToString(), typeof(String)),
				new DataColumn(Field.DIENTHOAI.ToString(), typeof(String)),
				new DataColumn(Field.FAX.ToString(), typeof(String)),
				new DataColumn(Field.MSTHUE.ToString(), typeof(String)),
				new DataColumn(Field.NHACUNGCAP.ToString(), typeof(Boolean)),
				new DataColumn(Field.TAIKHOAN.ToString(), typeof(String)),
				new DataColumn(Field.NGANHANG.ToString(), typeof(String)),
				new DataColumn(Field.TINH_TP.ToString(), typeof(String)),
				new DataColumn(Field.HMDUNO.ToString(), typeof(Double)),
				new DataColumn(Field.TRANSLOCK.ToString(), typeof(Boolean))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.CUSTID.ToString()] = _CUSTID;
			row[Field.TENGD.ToString()] = _TENGD;
			row[Field.DAIDIEN.ToString()] = _DAIDIEN;
			row[Field.DIACHI.ToString()] = _DIACHI;
			row[Field.DIENTHOAI.ToString()] = _DIENTHOAI;
			row[Field.FAX.ToString()] = _FAX;
			row[Field.MSTHUE.ToString()] = _MSTHUE;
			row[Field.NHACUNGCAP.ToString()] = _NHACUNGCAP;
			row[Field.TAIKHOAN.ToString()] = _TAIKHOAN;
			row[Field.NGANHANG.ToString()] = _NGANHANG;
			row[Field.TINH_TP.ToString()] = _TINH_TP;
			row[Field.HMDUNO.ToString()] = _HMDUNO;
			row[Field.TRANSLOCK.ToString()] = _TRANSLOCK;
			return row;
		}
        #endregion InitTable
    }
}
